const path = require("path");


module.exports = app => {

  return {
    name: "demo",
    onIndex: async (ctx) => {
      return { "aaa": "dasda" };
    },
    OnDeleteUser: async (UserID, t, pipeline) => {

    },
    onAppLaunch: async (pid) => {
      let redisfx = app.redis.get("livelog")
      redisfx.subscribe("news")
      redisfx.on("message", (channel, message) => {
        app.SendClusterMsg(JSON.stringify({ channel, message }));
      });
    },
    onEggMsgClusterRecv: async (data) => {
      app.CoreAPI.Log.trace(`pid=${process.pid},onEggMsgClusterRecv=${data}`);
      console.log("pid", process.pid, "onEggMsgClusterRecv", data);
    }
  }

}
